package com.xiaoxu.auth;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication(scanBasePackages = {"com.xiaoxu.auth","com.xiaoxu.base"})
@Slf4j
@EnableFeignClients(basePackages={"com.xiaoxu.auth"})
public class AuthApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext ctx = SpringApplication.run(AuthApplication.class, args);
        log.info("\n"+"\t\t\t\t******************************************"+"\n"+"\t\t\t\t**\t贝壳学堂- {} 模块项目启动成功" +
                        "\t**"+"\n\t\t\t\t**\t\t\t贝壳学堂-版本v1.0测试版\t\t**"+"\n\t\t\t\t**\t贝壳学堂-系统配置模块端口号: {}" +
                        "\t\t**"+"\n\t\t\t\t******************************************"
                ,ctx.getEnvironment().getProperty("spring.application.name")
                ,ctx.getEnvironment().getProperty("server.port"));
    }

    @Bean
    RestTemplate restTemplate(){
        return new RestTemplate(new OkHttp3ClientHttpRequestFactory());
    }

}
